package cn.edu.hhtc.stsystem.security.dao;

import org.springframework.stereotype.Repository;

import cn.edu.hhtc.hibernate.utils.HibernateDao;
import cn.edu.hhtc.stsystem.Exception.DaoException;
import cn.edu.hhtc.stsystem.security.domain.SysUsers;

/**
 * 系统用户dao.
 * 
 * @author linyueqin
 * 
 */
@Repository
public class SysUsersDao extends HibernateDao<SysUsers, Long> {

	public SysUsers queryUserByLoginName(String loginName) throws DaoException {

		return (SysUsers) super.createQuery("from SysUsers t where t.loginName=?", loginName).uniqueResult();
	}

	public String queryPasswordByLoginName(String loginName) throws DaoException {

		return (String) super.createQuery("select t.password from SysUsers t where t.loginName=?", loginName)
				.uniqueResult();
	}
}
